package io.renren.modules.medical.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.medical.validator.EnumValue;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * @author Luo Sheng
 * @school YiBin university
 * @create 2023-03-23 22:33
 */
// 医生信息实体
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("doctor_info")
public class DoctorInfoEntity extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @TableField("user_id")
    @NotNull(message = "修改或添加时用户id不能未空", groups = {AddGroup.class, UpdateGroup.class})
    private Long userId;

    @TableField("avatar")
    @Null(message = "修改或添加时不能带有头像", groups = {AddGroup.class, UpdateGroup.class})
    private String avatar;

    /**
     * 邮箱
     */
    @NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    private String email;

    @TableField("phone")
    @NotBlank(message = "修改或添加时用户id不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String phone;

    @TableField("name")
    @NotBlank(message = "修改或添加时医生名字不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @TableField("sex")
    @EnumValue(intValues = {0,1}, groups = {AddGroup.class, UpdateGroup.class}, message = "修改或添加时医生性别不能为空")
    private Integer sex;

    @TableField("dep_id")
    @NotNull(message = "修改或添加时医生科室不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Long depId;

    @TableField("description")
    @NotBlank(message = "修改或添加时description不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String description;

}
